﻿<div class="ph-tabs">
    <ul>
        <li class="k-state-active">机构列表</li>
    </ul>
    <div>
        <div id="grid_bureau" style="text-align: center"></div>
    </div>
</div>

<script class="init">
    LocatedMenu("单位管理", "直属机构");
</script>

<script class="grid_school_columns">
    var bureauFields = [{
        title: "编码",
        field: "Code",
        width: 60
    }, {
        title: "机构名称",
        field: "EduName",
        width: 200
    }, {
        title: "用户名",
        field: "User.UserName",
        width: 150
    }, {
        title: "负责人",
        field: "User.RealName",
        width: 150
    }, {
        title: "联系手机",
        field: "User.Mobile",
        width: 100
    }, {
        title: "Email",
        field: "User.Email",
        template: "#: User.Email # <a href='javascript:ChangeEmail(\"#:User.Guid#\")' class='k-icon k-i-pencil'>&nbsp;</a>",
        width: 200
    }, {
        title: "添加时间",
        template: "#=kendo.toString(kendo.parseDate(CreatedOn),'yyyy-MM-dd')#",
        width: 100
    }, {}];

    function ChangeEmail(guid) {
        if (wndGeneralEdit != null && typeof wndGeneralEdit != "undefined") {
            wndGeneralEdit.setOptions({ title: "修改帐号Email" });
            wndGeneralEdit.refresh({ url: "/Accounts/User/Email/" + guid });
            wndGeneralEdit.open();
        }
    }
</script>

<script class="grid_config">
    $(function () {
        $("#grid_bureau").kendoGrid({
            columns: bureauFields,
            dataSource: Whale.dataSource({
                url: "/Systems/Bureau/Gets",
                getParameters: function () {
                    return {
                        getUser: true
                    };
                }
            }),
            pageable: false,
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });
</script>
